package cn.tedu.charging.device.controller;

import cn.tedu.charging.common.pojo.vo.StationDetailVO;
import cn.tedu.charging.common.pojo.vo.StationInfoVO;
import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.device.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StationController {
    @Autowired
    private StationService stationService;

    @GetMapping("/device/station/near")
    public JsonResult<List<StationInfoVO>> nearbyStation(Double longitude, Double latitude,Double radius){
        List<StationInfoVO> vos = stationService.nearbyStation(longitude, latitude,radius);
        return JsonResult.ok(vos);
    }

    @GetMapping("/device/station/detail/{stationId}")
    public JsonResult<StationDetailVO> StationDetail(@PathVariable Integer stationId){
        StationDetailVO vo = stationService.StationDetail(stationId);
        return JsonResult.ok(vo);
    }
}
